package com.mic.yzzn.plc.common.control.datastructure;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by ASH on 16/4/8.
 */

public class PLCCollectorStatus implements Serializable
{

    public static final int PLCCollectorStateActive = 0,
            PLCCollectorStateSleep = 1,
            PLCCollectorStateStop = 2;

    /**
	 * 序列化版本号
	 */
	private static final long serialVersionUID = 5981968149070902118L;

    /** 采集器ID IP-PORT-LOCATION*/
    private String collectorID;
    /** 采集器的状态 */
    private int state;
    /** 采集器开始采集的时间 */
    private Date collectorStartTime;
    /** 周期队列的状态 */
    private PLCCollectorQueueStatus cycleQueueState = new PLCCollectorQueueStatus();
    /** 实时读队列的状态 */
    private PLCCollectorQueueStatus realTimeReadQueueState = new PLCCollectorQueueStatus();
    /** 实时写队列的状态 */
    private PLCCollectorQueueStatus realTimeWriteQueueState = new PLCCollectorQueueStatus();

    @Override
    public String toString()
    {
        StringBuffer buffer = new StringBuffer();
        buffer.append(collectorID + "采集器 ");
        buffer.append("从" + collectorStartTime + "开始采集 ");
        buffer.append("目前处于" + state + " 状态\n");
        buffer.append("周期队列: " + cycleQueueState.toString() + "\n");
        buffer.append("实时读队列: " + realTimeReadQueueState.toString() + "\n");
        buffer.append("实时写队列: " + realTimeWriteQueueState.toString());

        return buffer.toString();
    }


    // Getter

    public String getCollectorID()
    {
        return collectorID;
    }

    public int getState()
    {
        return state;
    }

    public Date getCollectorStartTime()
    {
        return collectorStartTime;
    }

    public PLCCollectorQueueStatus getCycleQueueState()
    {
        return cycleQueueState;
    }

    public PLCCollectorQueueStatus getRealTimeReadQueueState()
    {
        return realTimeReadQueueState;
    }

    public PLCCollectorQueueStatus getRealTimeWriteQueueState()
    {
        return realTimeWriteQueueState;
    }

    // Setter


    public void setCollectorID(String collectorID)
    {
        this.collectorID = collectorID;
    }

    public void setState(int state)
    {
        this.state = state;
    }

    public void setCollectorStartTime(Date collectorStartTime)
    {
        this.collectorStartTime = collectorStartTime;
    }

    public void setCycleQueueState(PLCCollectorQueueStatus cycleQueueState)
    {
        this.cycleQueueState = cycleQueueState;
    }

    public void setRealTimeReadQueueState(PLCCollectorQueueStatus realTimeReadQueueState)
    {
        this.realTimeReadQueueState = realTimeReadQueueState;
    }

    public void setRealTimeWriteQueueState(PLCCollectorQueueStatus realTimeWriteQueueState)
    {
        this.realTimeWriteQueueState = realTimeWriteQueueState;
    }
}
